package com.hand.lei;

import java.io.*;
import java.util.*;

/*
 * Quick Support for EBS;
 * 2013, Lei Peng, all rights reserved;
 * This class is used for log messages;
 * The messages will be stored as plain text;
 * The pictures in messages will be insteaded by '[Picture:Picture File Name]';
 * The log file should be named as 'USERNAME.log' or 'USERNAME.txt';
 */
class log extends Object {
	protected String logFile;

	public log(String logF) {
		this.logFile = logF;
	}

	public void write(String from, String text) {
		try {
			FileOutputStream fOut = new FileOutputStream(this.logFile, true);
			String time = from + ","
					+ Calendar.getInstance().getTime().toString() + "\n";
			fOut.write(time.getBytes());
			fOut.write(text.getBytes());
			fOut.write('\n');
			fOut.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}